fix(types): Add missing fields to request and response types#3217
fix(types): Add missing fields to request and response types#3217mpint wants to merge 15 commits intoXRPLF:mainfrom
Conversation
…countLinesResponse
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
WalkthroughThis PR expands optional fields across multiple XRPL model interfaces (AccountLines, AccountNFTs, AMMInfo, NFT operations, and VaultInfo) to support pagination and filtering capabilities, and adds comprehensive integration tests validating the new fields and response structures. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@mpint can you fix the linter errors in the CI? |
ckeshava
left a comment
There was a problem hiding this comment.
Please add integration tests that exercise the newly added fields of the request/response methods.
| */ | ||
| marker?: unknown | ||
| /** | ||
| * The limit value used in the request. |
There was a problem hiding this comment.
This comment is not true. Please use the text from the xrpl.org website verbatim:
The maximum number of trust lines retrieved. The server may return fewer than the specified limit, even if more results are available. If no limit was specified in the request, use a default limit of 200.
| asset2?: Currency | ||
|
|
||
| /** | ||
| * The address of another account which holds LP Tokens for the requested AMM. |
There was a problem hiding this comment.
This comment is not correct. The documentation text reads:
Show only LP Tokens held by this liquidity provider.
|
@mpint You can fix the linter errors by applying this patch: |
| @@ -132,5 +138,9 @@ export interface AccountLinesResponse extends BaseResponse { | |||
| * No additional pages after this one. | |||
| */ | |||
| marker?: unknown | |||
There was a problem hiding this comment.
I wonder if there should be another base type for marker/limit (like LookupByLedgerRequest)
There was a problem hiding this comment.
The idea being easier type composability (e.g. type C = A & B)?
There was a problem hiding this comment.
What do you think about this @mvadari ? Took a quick look at this and it would dry things up nicely (11 impacted types for PaginationRequest and 12 for PaginationResponse). Happy to do it in another PR.
export interface PaginationRequest {
/** Limit the number of results to retrieve. */
limit?: number
/** Value from a previous paginated response. Resume retrieving data where that response left off. */
marker?: unknown
}
export interface PaginationResponse {
marker?: unknown
limit?: number
}
There was a problem hiding this comment.
Yeah, I like that! Fine with it being in a separate PR
There was a problem hiding this comment.
🧹 Nitpick comments (3)
MISSING_FIELDS--DONE.md (1)
1-244: Consider removing this planning document from the repository.This file appears to be an implementation plan and PR template that was used during development. Such planning documents are typically kept in PR descriptions, issue trackers, or project wikis rather than committed to the repository. If this file serves a documentation purpose for the changes made, consider consolidating it into CHANGELOG entries or removing it before merge.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@MISSING_FIELDS--DONE.md` around lines 1 - 244, Remove the MISSING_FIELDS--DONE.md planning document from the repository (or move its contents into the PR description, issue tracker, project wiki, or a changelog entry) so only the implementation code and generated OpenAPI/schema artifacts remain committed; if you need to preserve the notes, create a concise CHANGELOG entry or link the issue/PR instead, then commit the deletion and update the PR to reflect the removal.FUNDAMENTAL_TYPE_REFACTORING_PLAN.md (1)
1-1082: Consider whether this planning document should be in the repository.This comprehensive 1000+ line refactoring plan documents a significant type system overhaul for
ts-json-schema-generatorcompatibility. While valuable, this appears to be:
- Out of scope for this PR - The PR title indicates "missing fields" changes, not the fundamental type refactoring described here.
- Better suited for alternative locations - Such detailed architectural plans typically reside in:
- GitHub Discussions or Issues
- Project wiki
- ADR (Architecture Decision Record) folder if the project uses them
- Separate design document repository
If this is intentionally included to document future work, consider adding a clear note at the top indicating its purpose (e.g., "Future Work" or "Proposed RFC").
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@FUNDAMENTAL_TYPE_REFACTORING_PLAN.md` around lines 1 - 1082, The review flags that the large "FUNDAMENTAL_TYPE_REFACTORING_PLAN.md" is out-of-scope for this PR (which targets "missing fields"); remove or relocate the file from this PR and instead publish it as a separate design artifact (e.g., GitHub Discussion, Issue, ADR folder, or a dedicated RFC repository) or, if keeping in-tree for visibility, add a clear top-level note indicating "Proposed RFC / Future Work — not part of current PR" and convert it to a draft (so it won't be merged as part of this change); ensure references to symbols like TransactionMetadata, TxResponse, LedgerEntryResponse, SimulateRequest, and TransactionSchema remain in the new location and update the PR to only include the intended "missing fields" changes.packages/xrpl/test/integration/requests/ammInfo.test.ts (1)
46-68: Consider asserting account-specific LP token information.The test validates that the
accountparameter is accepted, but it doesn't verify the account-specific behavior. According to the XRP Ledger API, when anaccountis provided, the response should include the amount of that account's LP Tokens. Consider adding an assertion for thelp_tokenfield specific to the provided account to strengthen the test.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/xrpl/test/integration/requests/ammInfo.test.ts` around lines 46 - 68, The test checks general AMM fields but misses validating account-specific LP token info; after fetching amm from ammInfoRes.result, add an assertion that amm.lp_token equals the expected LP token amount for lpWallet (use lpWallet.classicAddress / any LP balance value set up in ammPool during test setup to derive the expected string) — e.g., assert.equal(amm.lp_token, '<expected_lp_token_value>') using the expected value from your ammPool setup so the test verifies the account-specific LP token field is returned.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@FUNDAMENTAL_TYPE_REFACTORING_PLAN.md`:
- Around line 1-1082: The review flags that the large
"FUNDAMENTAL_TYPE_REFACTORING_PLAN.md" is out-of-scope for this PR (which
targets "missing fields"); remove or relocate the file from this PR and instead
publish it as a separate design artifact (e.g., GitHub Discussion, Issue, ADR
folder, or a dedicated RFC repository) or, if keeping in-tree for visibility,
add a clear top-level note indicating "Proposed RFC / Future Work — not part of
current PR" and convert it to a draft (so it won't be merged as part of this
change); ensure references to symbols like TransactionMetadata, TxResponse,
LedgerEntryResponse, SimulateRequest, and TransactionSchema remain in the new
location and update the PR to only include the intended "missing fields"
changes.
In `@MISSING_FIELDS--DONE.md`:
- Around line 1-244: Remove the MISSING_FIELDS--DONE.md planning document from
the repository (or move its contents into the PR description, issue tracker,
project wiki, or a changelog entry) so only the implementation code and
generated OpenAPI/schema artifacts remain committed; if you need to preserve the
notes, create a concise CHANGELOG entry or link the issue/PR instead, then
commit the deletion and update the PR to reflect the removal.
In `@packages/xrpl/test/integration/requests/ammInfo.test.ts`:
- Around line 46-68: The test checks general AMM fields but misses validating
account-specific LP token info; after fetching amm from ammInfoRes.result, add
an assertion that amm.lp_token equals the expected LP token amount for lpWallet
(use lpWallet.classicAddress / any LP balance value set up in ammPool during
test setup to derive the expected string) — e.g., assert.equal(amm.lp_token,
'<expected_lp_token_value>') using the expected value from your ammPool setup so
the test verifies the account-specific LP token field is returned.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
FUNDAMENTAL_TYPE_REFACTORING_PLAN.mdMISSING_FIELDS--DONE.mdTYPE_SYSTEM_QUALITY.mdpackages/xrpl/src/models/methods/accountLines.tspackages/xrpl/src/models/methods/ammInfo.tspackages/xrpl/src/models/methods/nftBuyOffers.tspackages/xrpl/src/models/methods/nftSellOffers.tspackages/xrpl/test/integration/requests/accountLines.test.tspackages/xrpl/test/integration/requests/ammInfo.test.tspackages/xrpl/test/integration/requests/vaultInfo.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- packages/xrpl/src/models/methods/accountLines.ts
- packages/xrpl/src/models/methods/nftSellOffers.ts
- packages/xrpl/src/models/methods/nftBuyOffers.ts
- packages/xrpl/src/models/methods/ammInfo.ts
|
Hi @ckeshava, I've addressed the integration test request by updating existing integration test files to cover the newly added fields: ✅ Updated existing integration tests:
📝 Note on missing test coverage: The following newly added fields don't have dedicated integration test files yet:
These NFT methods are currently only tested indirectly within transaction tests. Would you like me to create new integration test files for these methods in this PR, or should that be saved for another body of work to keep this PR focused on the type additions? |
f08bd64 to
ff6c5a5
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/xrpl/src/models/methods/nftBuyOffers.ts (1)
45-53: Add dedicated integration coverage fornft_buy_offerspagination fields.These new response fields (
limit,marker) should be covered by a method-specific integration test to prevent future drift in typed API contracts.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/xrpl/src/models/methods/nftBuyOffers.ts` around lines 45 - 53, Add an integration test that verifies the nft_buy_offers pagination fields are preserved and typed: call the nftBuyOffers method (or exported function handling nft_buy_offers) against a test instance/fixture returning a response with limit and marker, assert the returned NftBuyOffersResponse (or equivalent DTO) exposes limit as a number and marker with the expected value/type, and update the method's parsing/types if the test fails; focus assertions on the limit and marker fields to prevent future contract drift.packages/xrpl/src/models/methods/nftSellOffers.ts (1)
18-27: Add integration coverage fornft_sell_offerspagination fields.
limitandmarkerwere added on Line 22 and Line 27, but this PR context indicates no dedicatednftSellOffersintegration test exists yet. Please add request/response assertions for these fields to prevent type regressions.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/xrpl/src/models/methods/nftSellOffers.ts` around lines 18 - 27, Add an integration test for nftSellOffers that sends a request including both limit and marker and asserts the client transmits those fields and correctly parses them from the server response: create a test that calls the nftSellOffers method (or the higher-level client wrapper that invokes it) with a specific limit and marker, mock or capture the outgoing request to assert the request body/query contains limit and marker, return a mock paginated response including marker and any truncated/limited result set, and assert the parsed response object exposes the same limit/marker values (and any types used for marker) so regressions in request/response handling for the nftSellOffers pagination fields are caught.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/xrpl/src/models/methods/nftBuyOffers.ts`:
- Around line 45-53: Add an integration test that verifies the nft_buy_offers
pagination fields are preserved and typed: call the nftBuyOffers method (or
exported function handling nft_buy_offers) against a test instance/fixture
returning a response with limit and marker, assert the returned
NftBuyOffersResponse (or equivalent DTO) exposes limit as a number and marker
with the expected value/type, and update the method's parsing/types if the test
fails; focus assertions on the limit and marker fields to prevent future
contract drift.
In `@packages/xrpl/src/models/methods/nftSellOffers.ts`:
- Around line 18-27: Add an integration test for nftSellOffers that sends a
request including both limit and marker and asserts the client transmits those
fields and correctly parses them from the server response: create a test that
calls the nftSellOffers method (or the higher-level client wrapper that invokes
it) with a specific limit and marker, mock or capture the outgoing request to
assert the request body/query contains limit and marker, return a mock paginated
response including marker and any truncated/limited result set, and assert the
parsed response object exposes the same limit/marker values (and any types used
for marker) so regressions in request/response handling for the nftSellOffers
pagination fields are caught.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
packages/xrpl/src/models/methods/accountLines.tspackages/xrpl/src/models/methods/ammInfo.tspackages/xrpl/src/models/methods/nftBuyOffers.tspackages/xrpl/src/models/methods/nftSellOffers.tspackages/xrpl/test/integration/requests/accountLines.test.tspackages/xrpl/test/integration/requests/ammInfo.test.tspackages/xrpl/test/integration/requests/vaultInfo.test.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/xrpl/src/models/methods/ammInfo.ts
- packages/xrpl/test/integration/requests/vaultInfo.test.ts
- packages/xrpl/test/integration/requests/accountLines.test.ts
Please create a new integration test file for all the updated Request-models. That will help us detect any future errors in the responses from these Requests. |
- Add nftBuyOffers.test.ts for NFTBuyOffersRequest/Response - Add nftSellOffers.test.ts for NFTSellOffersRequest/Response - Add accountNFTs.test.ts for AccountNFTsRequest/Response Tests cover newly added fields including limit, marker, ledger_hash, ledger_index, and validated fields. All tests passing. Addresses review comment: XRPLF#3217 (comment)
There was a problem hiding this comment.
🧹 Nitpick comments (4)
packages/xrpl/test/integration/requests/accountNFTs.test.ts (1)
150-151: Redundant assertion.Same pattern as the other test files—
assert.isDefinedis unnecessary inside theifblock.♻️ Proposed fix
// If there are more results, marker should be present if (response.result.marker !== undefined) { - assert.isDefined(response.result.marker) // Test pagination with marker const nextRequest: AccountNFTsRequest = {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/xrpl/test/integration/requests/accountNFTs.test.ts` around lines 150 - 151, Remove the redundant assertion inside the conditional: since the if (response.result.marker !== undefined) already guarantees presence, delete the assert.isDefined(response.result.marker) line (referencing response.result.marker and the surrounding if block in accountNFTs.test.ts) so the test doesn't duplicate checks.packages/xrpl/test/integration/requests/nftBuyOffers.test.ts (1)
120-121: Redundant assertion.Same as in
nftSellOffers.test.ts—assert.isDefinedis unnecessary inside theif (marker !== undefined)block.♻️ Proposed fix
// If there are more results, marker should be present if (response.result.marker !== undefined) { - assert.isDefined(response.result.marker) // Test pagination with marker const nextRequest: NFTBuyOffersRequest = {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/xrpl/test/integration/requests/nftBuyOffers.test.ts` around lines 120 - 121, The test contains a redundant assertion inside the conditional that already checks marker: remove the unnecessary assert.isDefined(response.result.marker) in nftBuyOffers.test.ts so the code simply branches on if (response.result.marker !== undefined) { ... } without re-asserting; locate the assertion referencing response.result.marker in the nftBuyOffers.test.ts test and delete that assert to match the pattern used in nftSellOffers.test.ts.packages/xrpl/test/integration/requests/nftSellOffers.test.ts (2)
111-112: Redundant assertion.
assert.isDefined(response.result.marker)is unnecessary since it's already inside anif (response.result.marker !== undefined)block.♻️ Proposed fix
// If there are more results, marker should be present if (response.result.marker !== undefined) { - assert.isDefined(response.result.marker) // Test pagination with marker const nextRequest: NFTSellOffersRequest = {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/xrpl/test/integration/requests/nftSellOffers.test.ts` around lines 111 - 112, The test contains a redundant assertion: inside the if-check for response.result.marker !== undefined you call assert.isDefined(response.result.marker); remove that redundant assert (or invert logic and replace the if with an assert if you intended a required value). Update the test around response.result.marker (the conditional using response.result.marker !== undefined and the call to assert.isDefined) so you either remove the assert inside the if-block or refactor the if into an assert that validates presence before using the marker.
9-12: Remove unused imports.
xrpToDropsandunixTimeToRippleTimeare imported but will be unnecessary after fixing theNFTokenMintfields. The only remaining use ofxrpToDropswould be insellOfferTxafter applying the fix (and in the "additional sell offer" test at line 134).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/xrpl/test/integration/requests/nftSellOffers.test.ts` around lines 9 - 12, Remove the unused imports xrpToDrops and unixTimeToRippleTime from the import list in nftSellOffers.test.ts (they become unnecessary once the NFTokenMint fields are fixed); update references so only required uses remain (confirm sellOfferTx and the "additional sell offer" test still use xrpToDrops if needed) and delete the two imports (xrpToDrops, unixTimeToRippleTime) from the import block to eliminate unused-import warnings.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/xrpl/test/integration/requests/accountNFTs.test.ts`:
- Around line 150-151: Remove the redundant assertion inside the conditional:
since the if (response.result.marker !== undefined) already guarantees presence,
delete the assert.isDefined(response.result.marker) line (referencing
response.result.marker and the surrounding if block in accountNFTs.test.ts) so
the test doesn't duplicate checks.
In `@packages/xrpl/test/integration/requests/nftBuyOffers.test.ts`:
- Around line 120-121: The test contains a redundant assertion inside the
conditional that already checks marker: remove the unnecessary
assert.isDefined(response.result.marker) in nftBuyOffers.test.ts so the code
simply branches on if (response.result.marker !== undefined) { ... } without
re-asserting; locate the assertion referencing response.result.marker in the
nftBuyOffers.test.ts test and delete that assert to match the pattern used in
nftSellOffers.test.ts.
In `@packages/xrpl/test/integration/requests/nftSellOffers.test.ts`:
- Around line 111-112: The test contains a redundant assertion: inside the
if-check for response.result.marker !== undefined you call
assert.isDefined(response.result.marker); remove that redundant assert (or
invert logic and replace the if with an assert if you intended a required
value). Update the test around response.result.marker (the conditional using
response.result.marker !== undefined and the call to assert.isDefined) so you
either remove the assert inside the if-block or refactor the if into an assert
that validates presence before using the marker.
- Around line 9-12: Remove the unused imports xrpToDrops and
unixTimeToRippleTime from the import list in nftSellOffers.test.ts (they become
unnecessary once the NFTokenMint fields are fixed); update references so only
required uses remain (confirm sellOfferTx and the "additional sell offer" test
still use xrpToDrops if needed) and delete the two imports (xrpToDrops,
unixTimeToRippleTime) from the import block to eliminate unused-import warnings.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/xrpl/test/integration/requests/accountNFTs.test.tspackages/xrpl/test/integration/requests/nftBuyOffers.test.tspackages/xrpl/test/integration/requests/nftSellOffers.test.ts
…mports - Remove redundant assert.isDefined calls in marker checks (already inside undefined checks) - Remove unused unixTimeToRippleTime import from nftSellOffers.test.ts - Remove invalid Amount and Expiration fields from NFTokenMint transaction
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/xrpl/test/integration/requests/nftBuyOffers.test.ts`:
- Around line 51-54: The test currently assigns nftokenID to getNFTokenID(...)
?? 'undefined', which hides failures; change this to fail fast by checking the
return of getNFTokenID (the call inside nftBuyOffers.test.ts that sets
nftokenID) and throw or assert immediately if it is undefined (e.g., throw new
Error or use the test framework's assertion) so the test stops with a clear
error instead of using the literal 'undefined' in later requests.
- Around line 108-130: The test currently sets NFTBuyOffersRequest with limit: 1
but may pass without exercising pagination because only one offer exists; update
the test so pagination is guaranteed by either (A) creating at least two buy
offers for nftokenID in the test setup before calling
testContext.client.request, or (B) changing the request/limit to request fewer
results than exist (e.g., keep limit: 1 and ensure >1 offers exist). Locate the
NFTBuyOffersRequest construction and ensure the setup that creates offers
creates multiple offers for nftokenID (or adjust the limit) so
response.result.marker is present and the pagination branch (the subsequent
request using marker) is actually executed and asserted.
In `@packages/xrpl/test/integration/requests/nftSellOffers.test.ts`:
- Around line 50-53: The test assigns nftokenID using getNFTokenID(...) but
falls back to the literal string 'undefined', which allows a malformed ID to
propagate; replace that fallback with an explicit failure: after calling
getNFTokenID with txResponse.result.meta (TransactionMetadata<NFTokenMint>),
check whether the result is undefined and if so throw or assert (fail the test)
with a clear message referencing getNFTokenID and nftokenID so the test stops
immediately instead of continuing with an invalid ID.
- Around line 96-117: The pagination branch may not run because only one sell
offer exists; update the "with marker field for pagination" test so it
deterministically exercises marker pagination by ensuring multiple offers exist
before calling NFTSellOffersRequest: create and submit at least two sell offers
for the same nftokenID in the test setup (using the same helper/fixture you use
elsewhere to create offers), then perform the request with limit: 1 and assert
response.result.marker is defined before using it to fetch the next page via
testContext.client.request.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/xrpl/test/integration/requests/accountNFTs.test.tspackages/xrpl/test/integration/requests/nftBuyOffers.test.tspackages/xrpl/test/integration/requests/nftSellOffers.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/xrpl/test/integration/requests/accountNFTs.test.ts
| ledger_index: 'validated', | ||
| } | ||
| const response = await testContext.client.request(request) | ||
| assert.equal(response.type, 'response') |
There was a problem hiding this comment.
check for the successful completion of the response
| // ledger_index should be present when using validated ledger | ||
| if (response.result.ledger_index !== undefined) { | ||
| assert.isNumber(response.result.ledger_index) | ||
| assert.isAtLeast(response.result.ledger_index, 1) | ||
| } |
There was a problem hiding this comment.
this assertion can be combined with the above test
|
|
||
| assert.equal(response.type, 'response') | ||
| assert.equal(response.result.nft_id, nftokenID) | ||
| // The limit field should be present in the response |
There was a problem hiding this comment.
this test fails silently if the limit field is absent in the response.
assert.isNotNull(response.result.limit, 'limit value must be present in the reponse');
I feel this is better ^
…ness - Fix linter errors in testUtils.ts by removing unnecessary non-null assertions and avoiding variable shadowing - Improve NFT test robustness by explicitly checking for NFTokenID extraction failures instead of masking them with ?? 'undefined' - Remove planning documents as requested by CodeRabbit
- Add status assertion in accountLines test for successful completion - Make limit field assertion non-conditional in nftBuyOffers test - Combine ledger_hash and ledger_index tests in accountNFTs test
- nftBuyOffers: Create second buy offer to ensure marker pagination is exercised - nftSellOffers: Add initial sell offer in setup as comment indicated - nftSellOffers: Create second sell offer to ensure marker pagination is exercised - Replace conditional pagination checks with assertions to fail if marker is missing Addresses CodeRabbit comments about non-deterministic pagination tests
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/xrpl/test/integration/requests/accountLines.test.ts`:
- Around line 86-90: The test currently treats response.result.limit as
optional; make the assertion deterministic by asserting the field exists and has
the expected type/value before further checks: replace the if-check with
explicit assertions such as asserting response.result has property "limit" (or
assert.exists(response.result.limit)), then
assert.isNumber(response.result.limit) and
assert.isAtMost(response.result.limit, 10); update the assertions around the
variable response (from the accountLines test) so the test fails if the new
limit field is missing.
In `@packages/xrpl/test/integration/requests/accountNFTs.test.ts`:
- Around line 22-33: The pagination test is nondeterministic because only one
NFT is minted in beforeEach (mintTx) so the account_nfts response may not return
a marker; update the setup and test to force pagination deterministically by
creating enough NFTs (e.g., call testTransaction with NFTokenMint multiple times
in beforeEach or within the test) or by setting the request Limit to 1 so a
marker is guaranteed; then remove the conditional skip and assert on the
returned marker handling logic in the accountNFTs test (reference NFTokenMint
mintTx, testTransaction, and the response.marker assertion) so the marker path
is always exercised.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0aeab92f-97b3-4556-8f56-765f4abbf87f
📒 Files selected for processing (5)
packages/xrpl/test/integration/requests/accountLines.test.tspackages/xrpl/test/integration/requests/accountNFTs.test.tspackages/xrpl/test/integration/requests/nftBuyOffers.test.tspackages/xrpl/test/integration/requests/nftSellOffers.test.tspackages/xrpl/test/testUtils.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/xrpl/test/integration/requests/nftSellOffers.test.ts
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@FUNDAMENTAL_TYPE_REFACTORING_PLAN.md`:
- Around line 299-323: The TransactionSchema index-signature weakens public
typings; make it an internal-only schema type (e.g., rename to
InternalTransactionSchema) and stop using it as the public model. Keep the full
public union Transaction and TransactionBase for external exports, remove or
restrict the `[key: string]: unknown` from any type exported for consumers, and
where runtime-flexible schema is required (for schema generation or validation)
use the new InternalTransactionSchema and only export it from an internal
module; reference TransactionSchema, TransactionBase, Transaction, and
BaseTransaction to locate and change the exported types, and mirror the
xrpl.js/MPTokenMetadata approach by providing long-form explicit public
interfaces while keeping a separate flexible schema for runtime use.
- Around line 1-18: The roadmap in FUNDAMENTAL_TYPE_REFACTORING_PLAN.md proposes
repo-wide breaking refactors (affecting symbols/methods ledger, ledger_entry,
submit_multisigned, tx, simulate and referencing ranges 946-1082) and must be
removed from PR `#3217` and moved into a separate RFC/tracking issue; update the
PR to only include the targeted missing-fields/types fix by extracting or
deleting this document from the branch, create a new issue or RFC that contains
the full plan (linking the new issue from the PR), and ensure any references to
the plan (e.g., PR `#3217`, the listed methods) are replaced with a pointer to the
new tracking issue so the narrow fix PR remains non-breaking and focused.
- Around line 163-172: Document reproducible evidence before asserting
ts-json-schema-generator limitations: run the tool against the specific
conditional types discussed, capture and paste exact error outputs (e.g.,
"Error: Encountered a reference to a missing definition"), record the tested
ts-json-schema-generator and TypeScript versions, include the exact type
definitions that trigger failures and a minimal repro (commands/tsconfig) with
steps to reproduce, and reference these findings in the sections that claim the
generator “cannot evaluate conditional types” and the “Flatten to Union Types”
refactor rationale so the breaking-change decision is empirically justified.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 160ca7ad-7c74-41ca-87ae-adfe7c36ce98
📒 Files selected for processing (3)
FUNDAMENTAL_TYPE_REFACTORING_PLAN.mdpackages/xrpl/test/integration/requests/accountLines.test.tspackages/xrpl/test/integration/requests/accountNFTs.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/xrpl/test/integration/requests/accountLines.test.ts
- packages/xrpl/test/integration/requests/accountNFTs.test.ts
- accountLines: Make limit assertion non-conditional - accountNFTs: Mint two NFTs to ensure pagination is exercised - accountNFTs: Replace conditional marker check with assertion Addresses CodeRabbit comments about non-deterministic pagination tests
32f7bec to
6dd0338
Compare
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
| } | ||
| const response = await testContext.client.request(request) | ||
|
|
||
| assert.equal(response.type, 'response') |
There was a problem hiding this comment.
| assert.equal(response.type, 'response') | |
| assert.equal(response.result.status, 'success') |
| } | ||
| const response = await testContext.client.request(request) | ||
|
|
||
| assert.equal(response.type, 'response') |
There was a problem hiding this comment.
| assert.equal(response.type, 'response') | |
| assert.equal(response.result.status, 'success') |
| const response = await testContext.client.request(request) | ||
|
|
||
| assert.equal(response.type, 'response') | ||
| assert.equal(response.result.account, testContext.wallet.address) |
There was a problem hiding this comment.
| assert.equal(response.result.account, testContext.wallet.address) | |
| assert.equal(response.result.status, 'success') |
| marker: response.result.marker, | ||
| } | ||
| const nextResponse = await testContext.client.request(nextRequest) | ||
| assert.equal(nextResponse.type, 'response') |
There was a problem hiding this comment.
| assert.equal(nextResponse.type, 'response') | |
| assert.equal(nextResponse.result.status, 'success') |
| } | ||
| const nextResponse = await testContext.client.request(nextRequest) | ||
| assert.equal(nextResponse.type, 'response') | ||
| }, |
There was a problem hiding this comment.
Also assert that nextResponse does not have a marker field because it has reached the end of the results list.
High Level Overview of Change
This PR adds missing fields to various request and response types to improve type completeness and accuracy:
ledger_current_indexfieldlimitandmarkerfields for paginationlimitandmarkerfields for paginationaccountfieldledger_hash,ledger_index, andvalidatedfieldsignore_defaultfieldlimitfieldContext of Change
These fields are documented in the official XRP Ledger API documentation but were missing from the TypeScript type definitions. This discrepancy could lead to:
The fields were likely missing from the original type definitions when they were created, and this PR brings the types into alignment with the actual API specification.
Type of Change
Did you update HISTORY.md?
Test Plan
Tests Added
AccountLinesRequestto verify theignore_defaultfield works correctlyAMMInfoRequestto verify theaccountfield works correctlyVaultInfoResponseintegration tests to verify theledger_current_indexfieldHow to Reproduce/Test
npm run test:integrationTest Results
All integration tests pass successfully, confirming that:
Pull Request opened by Augment Code with guidance from the PR author